from rest_framework import serializers

from areas.models import Areas
class AreasSerializer(serializers.ModelSerializer):
    class Meta:
        model = Areas
        fields = ('id', 'name')

class SubsAreasSerializer(serializers.ModelSerializer):
    subs = AreasSerializer(many=True, label='下级地区')
    class Meta:
        model = Areas
        fields = ('id', 'name', 'subs')

